package com.wwf;

import redis.clients.jedis.HostAndPort;
import redis.clients.jedis.JedisCluster;
import redis.clients.jedis.JedisPoolConfig;

import java.util.HashSet;

public class JedisClusterTest {
    public static void main(String[] args) {
        JedisPoolConfig jedisPoolConfig = new JedisPoolConfig();
        HashSet<HostAndPort> jedisClusterNodes = new HashSet<HostAndPort>();
        jedisClusterNodes.add(new HostAndPort("192.168.195.101",7001));
        jedisClusterNodes.add(new HostAndPort("192.168.195.101",7002));
        jedisClusterNodes.add(new HostAndPort("192.168.195.101",7003));
        jedisClusterNodes.add(new HostAndPort("192.168.195.101",7004));
        jedisClusterNodes.add(new HostAndPort("192.168.195.101",7005));
        jedisClusterNodes.add(new HostAndPort("192.168.195.101",7006));
        jedisClusterNodes.add(new HostAndPort("192.168.195.101",7007));
        jedisClusterNodes.add(new HostAndPort("192.168.195.101",7008));
        JedisCluster jedisCluster = new JedisCluster(jedisClusterNodes, jedisPoolConfig);
        jedisCluster.set("name3","zhaoyun");
        String name2 = jedisCluster.get("name3");
        System.out.println(name2);
    }
}
